package com.ylkj.member.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.ylkj.common.base.BaseDaoHibernate;
import com.ylkj.common.entity.UserInfo;
import com.ylkj.member.dao.UserInfoDAO;

@Repository
public class UserInfoDAOImpl extends BaseDaoHibernate implements UserInfoDAO {

	@Override
	public void addUserInfo(UserInfo UserInfo) {
		this.getHibernateTemplate().save(UserInfo);
	}

	@Override
	public void addorUpdateUserInfo(UserInfo UserInfo) {
		this.getHibernateTemplate().saveOrUpdate(UserInfo);
	}

	@Override
	public void delUserInfo(UserInfo UserInfo) {
		this.getHibernateTemplate().delete(UserInfo);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<UserInfo> getUserInfoByNickName(String nickName) {
		String sql = "from UserInfo a where a.nickName='" + nickName + "'";
		List<UserInfo> list = this.getHibernateTemplate().find(sql);
		return list;
	}

}
